import sys
# # 标准输出流
# file = sys.stdout
# file.write("Hello")
# print("Hello")


# 在python中先打开文件才能读取文件
open("test.txt", "w")

# 不需要写close
# with open("./test.txt", "r", encoding='utf-8') as file2:
#     print(file2.readline())
#     print(file2.readline())

# 写入会覆盖文件
str1 = "21515"
with open("./test.txt", "w", encoding='utf-8') as file3:
    file3.write(str1)

# 写入不会覆盖文件，追加
list3 = ["Hello44","world22"]
with open("./test.txt", "a", encoding='utf-8') as file4:
    file4.writelines(list3)

# 中文一个字符等于三个字节utf-8
file = open("./test.txt", "rb")
print(file.read(1))
print(file.read(1))
print(file.tell())
print(file.seek(2, 0))
